/*
 * $Id: IAutoscWhiteListDAO.java,v 1.2 2012/02/15 23:07:49 oliver Exp $
 * 
 * Copyright (C) 2006 General Electric Company. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information of the General
 * Electric Company (GE). You shall not disclose this software and shall use it
 * only in accordance with the terms of the license agreement you entered into
 * with GE.
 * 
 * GE MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
 * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
 * NON-INFRINGEMENT. GE SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
 * AS A RESULT OF USING, MODIFYING, OR DISTRIBUTING THIS SOFTWARE OR ITS
 * DERIVATIVES.
 */
package com.ge.healthcare.autosc.common.database.dao;

import java.util.List;

import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.ge.healthcare.autosc.common.database.pojo.ActRequest;
import com.ge.healthcare.autosc.common.database.pojo.ActRequestListUser;

/**
 * @author 212042764
 *
 */
public interface IAutoscWhiteListDAO extends IBaseDAO {
	/**
	 * This method accepts the pojo and starts a new transaction so that it can
	 * always save the pojo in DB irrespective the calling transaction was
	 * success/failure
	 * 
	 * @param pojo
	 *            - pojo to save
	 */
	@Transactional(propagation = Propagation.REQUIRES_NEW)
	public void saveAlways(Object pojo);

	/**
	 * Pojo to save
	 * 
	 * @param pojo
	 *            - pojo to save
	 */
	public void save(Object pojo);

	/**
	 * Deletes the pojo
	 * 
	 * @param pojo
	 *            - pojo to delete
	 */
	public void deleteByID(Object pojo);

	/**
	 * The method will refresh the pojo to its current values in DB
	 * 
	 * @param pojo
	 *            - pojo to refresh
	 */
	public void refresh(Object pojo);

	/**
	 * Returns all valid email ids
	 * @return
	 */
	public List<String> getValidEmailIds();
	
	/**
	 * Checks to see if the supplied email id is in white list or not
	 * @param email
	 * @return
	 */
	public boolean isWhiteListedEmail(String email);

	/**
	 * Check to see if the user is valid for a request defn
	 * @param request
	 * @param user
	 * @return
	 */
	public boolean isValid(ActRequest request, ActRequestListUser user);

	public boolean isControlledRequestDefn(Long requestDefnId);
}
